<template>
	<svg :class="svgClass" aria-hidden="true">
		<use :xlink:href="iconName" />
	</svg>
</template>

<script lang="ts">
import { defineComponent, computed } from 'vue'

export default defineComponent({
	props: {
		name: {
			type: String,
			default: ''
		},

		color: {
			type: String,
			default: ''
		}
	},

	setup(props) {
		return {
			iconName: computed(() => `#icon-${props.name}`),
			svgClass: computed(() => {
				if (props.name) {
					return `svg-icon ${props.name}`
				}

				return 'svg-icon'
			})
		}
	}
})
</script>

<style lang="scss" scoped>
.svg-icon {
	width: 1.5em;
	height: 1.5em;
	vertical-align: -0.15em;
	fill: currentColor;
	overflow: hidden;
}
</style>
